#include <iostream>
#include <memory>
using namespace std;

class car;

class Person
{
public:
    Person()
    {
        cout << "Person()" << endl;
    }

    ~Person()
    {
        cout << "~Person()" << endl;
    }
    void func()
    {
        cout << "jjjjjj" << endl;
    }
};

int main()

{   
    unique_ptr<Person> p2 = nullptr;
    {
        unique_ptr<Person> p1(new Person);
        p2 = std::move(p1);
        p2->func();
        p1->func();
        // unique_ptr<Person> p2 = p1;
        /* 适用与数组 */
        //unique_ptr<Person[]> p1(new Person[3]{});
    }
    printf("---------\n");
}